package com.cloud.cloudvideo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.cloudvideo.entity.VideoMedia;
import com.cloud.cloudvideo.entity.VideoMediaPo;
import com.cloud.cloudvideo.mapper.VideoMediaMapper;
import com.cloud.cloudvideo.service.VideoRecycleService;
import com.cloud.cloudvideo.utils.Constants;

@Service
public class VideoRecycleServiceImpl implements VideoRecycleService{

	@Autowired
	private VideoMediaMapper videoMediaMapper;
	
	@Override
	public List<VideoMediaPo> list(String mediaorginalname) {
		VideoMedia vm = new VideoMedia();
		vm.setMediaorginalname(mediaorginalname);
		vm.setMeidiastatus(Constants.VIDEO_STATUS_DELETE);
		List<VideoMediaPo> list = videoMediaMapper.findVideoAndCate(vm);
		return list;
	}

	
	/**
	 * 恢复视频
	 */
	@Override
	public void recovery(Long id) {
		VideoMedia media = videoMediaMapper.selectByPrimaryKey(id);
		media.setMeidiastatus(Constants.VIDEO_STATUS_UNDELETE);
		videoMediaMapper.updateByPrimaryKeySelective(media);
	}


	@Override
	public void del(Long id) {
		videoMediaMapper.deleteByPrimaryKey(id);
	}
	
	
	

}
